package javase_class_250906;

/**
 * ClassName: SingletonDemo
 * Package: javase_class_250906
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/9/6 22:22
 * @Version 1.0
 */
public class SingletonDemo {
    public static void main(String[] args) {
        EagerSingleton singleton = EagerSingleton.getInstance();
        singleton.showMessage();

        // 尝试再次获取实例，应该是同一个对象
        EagerSingleton anotherSingleton = EagerSingleton.getInstance();
        System.out.println("Are they the same? " + (singleton == anotherSingleton)); // 输出 true
    }
}
